@extends('admin::layouts.master')
@section('title')
    邀请列表
@endsection
@section('tab')

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" id="form1">
                            <div class="layui-input-inline layui-show-xs-block" style="width: 300px; ">
                                <input type="text" name="name" placeholder="点击邀请者自动填充" value="{{$arr_search['name']}}" autocomplete="off" class="layui-input"></div>
                                <input type="hidden" name="user_id" value="{{ $arr_search['user_id'] }}">
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i>
                                </button>
                                <a class="layui-btn layui-btn-small" onclick="location.reload()" title="刷新">
                                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
                                </a>
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui_overflow_y ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>邀请者</th>
                                <th>被邀请者</th>
                                <th>邀请时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($data as $key=>$value)
                                <tr>
                                    <td>{{ $value['id'] }}</td>
                                    <td><a href="#" data-id="{{$value['user_id']}}" title="查看他所有的邀请" class="click_a"> {{ $value['get_user']['nickname'] }}</a></td>
                                    <td>{{ $value['get_to_user']['nickname'] }}</td>
                                    <td>{{ $value['created_at'] }}</td>
                                </tr>
                            @endforeach
                            @if(empty($data))
                                <td colspan="6" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection


@section('tab_js')
    <script>
        layui.use(['form', 'layer', 'jquery'], function () {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

            $(".click_a").click(function(){
                var user_id = $(this).attr('data-id');
                $("input[name='user_id']").val( user_id );
                $("input[name='name']").val( $(this).text() );
                $("#form1").submit();
            })
        })
    </script>
@endsection




